//这个是加图片水印的!
package com.img;

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.*;
import org.w3c.dom.*;
import com.sun.image.codec.jpeg.*;
import javax.imageio.*;

public class ImgBean_i{
public void ImgBean_i(){

}

public void ImgYin(String Imagename_biao,String ImgName){
try{
File _file = new File(ImgName);
Image src = ImageIO.read(_file);
int wideth=src.getWidth(null);
int height=src.getHeight(null);
BufferedImage image=new BufferedImage(wideth,height,BufferedImage.TYPE_INT_RGB);
Graphics g=image.createGraphics();
g.drawImage(src,0,0,wideth,height,null);

//水印文件
File _filebiao = new File(Imagename_biao);
Image src_biao = ImageIO.read(_filebiao);
int wideth_biao=src_biao.getWidth(null);
int height_biao=src_biao.getHeight(null);
g.drawImage(src_biao,wideth-110,height-30,wideth_biao,height_biao,null);
///
g.dispose();
FileOutputStream out=new FileOutputStream(ImgName);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(image);
out.close();
}
catch(Exception e){
System.out.println(e);
}
}
}